package com.goblin.model.base;

import com.goblin.common.response.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Pageable;

import java.util.List;

public abstract class ControllerAgency<T> {

    private static final Logger logger = LoggerFactory.getLogger(ControllerAgency.class);

    public abstract Response<T> get(Integer id);

    public abstract Response<List> getAll();

    public abstract Response<T> save(T t);

    public abstract Response<T> delete(List<Integer> ids, Integer type);

    public abstract Response<T> update(Integer id, T t);

    public abstract Response<T> getPageable(Pageable pageable);

    public void before(T t) {
        logger.debug("do controlleragency before");
    }

    public <T> Object after(T t) {
        logger.debug("do controlleragency after");
        return t;
    }

    public <T> Object afterSave(T t) {
        logger.debug("do after save method ");
        return t;
    }

}
